package iterator;

import java.util.Iterator;

/**
 * @ClassName MyCollection
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/6/30 14:22
 * @Version 1.0
 */
public class MyCollection<T> implements Iterable<T> {

	private T[] array;

	private int size;


	@Override
	public Iterator<T> iterator() {
		return new MyIterator();
	}

	class MyIterator implements Iterator<T>{

		int index;
		@Override
		public boolean hasNext() {
			return index < size;
		}

		@Override
		public T next() {
			return array[index];
		}
	}
}
